package com.lrkj.workorder.service.impl;

import java.util.List;
import com.lrkj.common.utils.DateUtils;
import com.lrkj.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lrkj.workorder.mapper.WorkOrderTempMapper;
import com.lrkj.workorder.domain.WorkOrderTemp;
import com.lrkj.workorder.service.IWorkOrderTempService;

/**
 * 工单模板Service业务层处理
 *
 * @author yajun_ren
 * @date 2022-04-18
 */
@Service
public class WorkOrderTempServiceImpl implements IWorkOrderTempService
{
    @Autowired
    private WorkOrderTempMapper workOrderTempMapper;

    /**
     * 查询工单模板
     *
     * @param id 工单模板ID
     * @return 工单模板
     */
    @Override
    public WorkOrderTemp selectWorkOrderTempById(String id)
    {
        return workOrderTempMapper.selectWorkOrderTempById(id);
    }

    /**
     * 查询工单模板列表
     *
     * @param workOrderTemp 工单模板
     * @return 工单模板
     */
    @Override
    public List<WorkOrderTemp> selectWorkOrderTempList(WorkOrderTemp workOrderTemp)
    {
        return workOrderTempMapper.selectWorkOrderTempList(workOrderTemp);
    }

    /**
     * 新增工单模板
     *
     * @param workOrderTemp 工单模板
     * @return 结果
     */
    @Override
    public int insertWorkOrderTemp(WorkOrderTemp workOrderTemp)
    {
        workOrderTemp.setId(IdUtils.simpleUUID());
        workOrderTemp.setCreateTime(DateUtils.getNowDate());
        return workOrderTempMapper.insertWorkOrderTemp(workOrderTemp);
    }

    /**
     * 修改工单模板
     *
     * @param workOrderTemp 工单模板
     * @return 结果
     */
    @Override
    public int updateWorkOrderTemp(WorkOrderTemp workOrderTemp)
    {
        workOrderTemp.setUpdateTime(DateUtils.getNowDate());
        return workOrderTempMapper.updateWorkOrderTemp(workOrderTemp);
    }

    /**
     * 批量删除工单模板
     *
     * @param ids 需要删除的工单模板ID
     * @return 结果
     */
    @Override
    public int deleteWorkOrderTempByIds(String[] ids)
    {
        return workOrderTempMapper.deleteWorkOrderTempByIds(ids);
    }

    /**
     * 删除工单模板信息
     *
     * @param id 工单模板ID
     * @return 结果
     */
    @Override
    public int deleteWorkOrderTempById(String id)
    {
        return workOrderTempMapper.deleteWorkOrderTempById(id);
    }
    /**
     * 批量新增工单模板信息
     *
     * @param workOrderTemps 工单模板对象
     */
    public int batchAddData(List<WorkOrderTemp> workOrderTemps)
    {
           return workOrderTempMapper.batchAddData(workOrderTemps);
    }
}
